<div>
    <h2 ng-i18next>
        avAdmin.sidebar.elections
    </h2>

    <table role="table" class="table electionlist" infinite-scroll="loadMoreElections()" infinite-scroll-distance="0">
        <!-- header row -->
        <thead>
          <tr>
            <th colspan="2">
              <div class="input-group search">
                <input type="text" class="form-control" ng-model="q" placeholder="{{'avAdmin.elections.filter' | i18next}}">
                <span class="input-group-btn">
                  <button class="btn btn-default" type="button"><i class="fa fa-search"></i></button>
                </span>
              </div>
            </th>
            <th class="text-center" ng-i18next> avAdmin.elections.status </th>
            <th class="text-center" ng-i18next> avAdmin.elections.participation </th>
          </tr>
        </thead>

        <tbody>
          <tr ng-repeat="election in elections | filter:q | orderBy:'-id'">
            <td>
              <a ui-sref="admin.dashboard({id: election.id})" class="padded">
                {{ election.id }}
              </a>
            </td>
            <td>
              <a ui-sref="admin.dashboard({id: election.id})">
                <strong>{{ election.title }}</strong>
                <div
                  ng-bind-html="election.description | htmlToText | truncate:150">
                </div>
              </a>
            </td>
            <td class="text-center">
              <a ui-sref="admin.dashboard({id: election.id})" class="padded text-av-secondary">
                {{ election.status|i18next }}
              </a>
            </td>
            <td class="text-center">
              <a ui-sref="admin.dashboard({id: election.id})">
                <strong>{{ election.votes }}</strong>
                <br/>
                <div clasS="italic">
                  {{ election.votes_percentage|number:0 }}%
                </div>
              </a>
            </td>
          </tr>
        </tbody>
    </table>
    <div ng-if="loading" class="text-center bg-primary" ng-i18next>loading</div>
    <div ng-if="nomore" class="text-center bg-success" ng-i18next>nomore</div>
    <div ng-if="error" class="text-center bg-danger">{{ error }}</div>
</div>
